// Problem: F - Guess the Numbers
// Idea: Recursive Descent Parsing + Brute Force
// Language: C++
// Author: Ivan Vladimirov Ivanov (ivan.vladimirov.ivanov@gmail.com)

#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm> 
#include <map>

using namespace std;

#define MAX 32

int  input(void);
void solve(void);

int eval(int &pos, map <char, int> &env);

int n, m;
int V[MAX];
string expr;

int main(void)
{
  while(input()) solve();

  return 0;
}

int input(void)
{
  scanf("%d", &n);
  if(n == 0) return 0;
  for(int i = 0; i < n; i++) scanf("%d", &V[i]);
  scanf("%d", &m);
  char buf[1024];
  scanf(" %s", buf);
  expr = buf;
  return 1;
}

void solve(void)
{
  vector <char> vars;
  for(int i = 0; i < expr.size(); i++) {
    if(expr[i] >= 'a' && expr[i] <= 'z') vars.push_back(expr[i]);
  }

  sort(vars.begin(), vars.end());
  unique(vars.begin(), vars.end());

  int good = 0;
  do {
    map <char, int> env;
    for(int i = 0; i < n; i++) env[vars[i]] = V[i];
    int pos = 0;
    if(eval(pos, env) == m) { good = 1; break; }
  } while(next_permutation(vars.begin(), vars.end()));

  printf("%s\n", good ? "YES" : "NO");
}

int eval(int &pos, map <char, int> &env)
{
  if(expr[pos] >= 'a' && expr[pos] <= 'z') {
    return env[expr[pos++]];
  }

  pos++;
  int left = eval(pos, env);
  char op = expr[pos++];
  int right = eval(pos, env);
  pos++;

  if(op == '+') return left + right;
  if(op == '-') return left - right;
  if(op == '*') return left * right;

  return -1;
}

